package inventoryServe.controller;


import inventoryServe.po.Role;
import inventoryServe.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import inventoryServe.utils.*;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author admin
 * @since 2021-06-22
 */
@Controller
public class RoleController {
    @Autowired
    private RoleService roleService;

    @GetMapping("/roles")
    @ResponseBody
    public Object allRole() {

        List<Role> res = this.roleService.allRole();

        if ( res != null) {
            return ResUtils.Success(1,"查询成功",res);
        } else {
            return ResUtils.Fail(0,"没有数据");
        }
    }
}

